<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use backend\assets\AppAsset;

/* @var $this yii\web\View */
AppAsset::register($this);
AppAsset::addScript($this, '@web/js/officeHall/uploadAssetPackage/uploadInformation.js');

$this->title = '资产包管理——上传基本信息';
?>
<?php echo Html::cssFile('@web/css/officeHall/uploadAssetPackage/uploadInformation.css'); ?>
    <!--中心内容区-->
    <div class="container content">
        <div class="row">
            <!--<div class="content-left pull-left col-md-2">
                <div class="list-group ">
                    <a href="#" class="list-group-item active">
                        <?php /*echo Html::img('@web/image/officeHall/uploadAssetPackage/upload.png', ['alt' => '', 'class' => 'pull-left']) */?>
                        <span>上传基本信息</span>
                    </a>
                    <a href="#" class="list-group-item">
                        <?php /*echo Html::img('@web/image/officeHall/uploadAssetPackage/new.png', ['alt' => '', 'class' => 'pull-left']) */?>
                        <span>我的新建记录</span></a>
                </div>
            </div>-->

            <div class="content-right " style="width: 100%;">
                <div class="upLoadInformation">
                    <span></span>
                    <p>上传资产包</p>
                </div>
                <div class="loadState">
                    <?php echo Html::img('@web/image/officeHall/uploadAssetPackage/loadState.png', ['alt' => '']) ?>
                </div>

                <?php /*$form = ActiveForm::begin([
                    'action' => ['package/index'], //提交地址(*可省略*)
                    'method' => 'post',    //提交方法(*可省略默认POST*)
                    'id' => 'package-add', //设置ID属性
                    //'enableAjaxValidation' => true, // 开启ajax验证
                    //'enableClientValidation' => true,
                    'options' => [
                        'class' => 'myForm form-inline', //设置class属性
                        'enctype' => 'multipart/form-data' //文件上传时添加该编码
                    ]
                ]); */?><!--
                --><?php /*echo $form->field($model, 'title', [
                        'inputOptions' => ['placeholder' => '请输入资产包名称（建议命名规则：地区+持包人简称+户数+本金）', 'autofocus' => 'autofocus', 'list' => "assetPackageTitle", 'class' => 'form-control', 'id' => 'assetPackageName']]
                )->textInput(['maxlength' => 255]); */?>

                <form action="<?php echo \yii\helpers\Url::toRoute(['package/index'])?>" method="post" id="package-add" class="myForm form-inline" enctype="multipart/form-data">

                <div class="form-group field-assetPackageName required has-success">
                    <label class="control-label" for="assetPackageName">资产包名称</label>
                    <input type="text" id="assetPackageName" class="form-control" name="Package[title]" value="TEST" maxlength="255"
                           placeholder="请输入资产包名称（建议命名规则：地区+持包人简称+户数+本金）" autofocus="autofocus" list="assetPackageTitle"
                            style="border: 1px solid rgb(226, 226, 226);">
                    <div class="help-block" style="color: rgb(169, 68, 66);"></div>
                </div>

                <br/>
                <p class="placeholder">请输入资产包名称（建议命名规则：地区+持包人简称+户数+本金）</p>

                <div class="form-group package_type">
                    <label for="exampleInputEmail2">资产包类型</label>
                    <input type="radio" name="Package[type]" placeholder="保证类" id="baozheng" value="1"/>
                    <label for="baozheng" class="baozheng">保证类</label>
                    <input type="radio" name="Package[type]" id="diya" value="2"/>
                    <label for="diya" class="diya">抵押类</label>
                    <input type="radio" name="Package[type]" id="hunhe" value="3"/>
                    <label for="hunhe" class="hunhe">混合类</label>
                </div>
                <br/>

                <div class="form-group jurisdiction">
                    <span for="exampleInputEmail2">访问权限</span>
                    <input type="radio" id="open" name="Package[access]" value="0"/>
                    <label for="open"><span></span>公开</label>
<!--                    <input type="radio" id="private" name="Package[access]" value="1"/>
                        <label for="private"><span></span>私密</label>-->
                    <input type="radio" id="partialDisclosure" name="Package[access]" value="2" checked="checked"/>
                    <label for="partialDisclosure" class="radioChecked"><span></span>部分公开</label>
                </div>
                <br/>

                <div class="form-group PublicSector">
                    <label>公开部门</label>

                    <!-- 部门人员 -->
                    <?php if (!empty($departments) && is_array($departments)) { ?>
                        <?php foreach ($departments as $key => $value) { ?>
                            <input type="checkbox" name="Package[department][]" class="sector"
                                   id="project<?php echo $key + 1; ?>" value="<?php echo $key + 1; ?>"/>
                            <label for="project<?php echo $key + 1; ?>"><?php echo $value['department'] ?></label>
                            <br/>

                            <div class="list_project<?php echo $key + 1; ?>  sectorList">
                                <input type="checkbox" class="whole" name="Package[access_users][]" value="0"/>
                                <label for="oneWhole2">全选</label>
                                <br/>
                                <?php if (!empty($value['users']) && is_array($value['users'])) { ?>
                                    <?php foreach ($value['users'] as $k => $v) { ?>
                                        <label for="<?php echo $v['id']; ?>">
                                            <input type="checkbox" class="access_users" name="Package[access_users][]"
                                                   value="<?php echo $v['id']; ?>"/> <?php echo $v['realname']; ?>
                                        </label>
                                    <?php } ?>
                                <?php } ?>
                            </div>
                        <?php } ?>
                    <?php } ?>
                </div>
                <br/>

                <div class="nextStep">
                    <?php /*echo Html::button('下一步', ['class' => 'btn btn-primary pu package_step1', 'name' => 'submit-button']) */?>
                    <button type="button" class="btn btn-primary pu package_step1">下一步</button>
                </div>

                <?php /*ActiveForm::end() */?>
                </form>

                <input type="hidden" id="validate_columns_url" value="<?php echo \yii\helpers\Url::toRoute(['package/validate-columns'])?>">

                <input type="hidden" id="access_type" value="2">
            </div>
        </div>
    </div>


<?php
$cssString = <<<CSS
.list-group {
    width:16.2%;
}
.list-group a {width:100%;}
.navbar {
	margin-bottom:0px!image
}
.nav {
    background: #fff;
    height: 60px;
    border-bottom: 1px solid #ccc;
}
.help-block {
    margin-left: 15px;
    float: right;
     margin-top: 0px!important; 
    /* margin-top: 5px; */
    margin-bottom: 10px;
    color: #737373;
}
.nav {
     border-bottom: 0px solid #ccc; 
}
.wrap {
    margin-top: 30px!important;
}

CSS;
$this->registerCss($cssString);
?>

<?php
$js = <<<JS
$(function() {
	
	//高亮显示
	$('#assetPackageName').focus(function(){
		$(this).css({
			"border":"1px solid #2194f1"
		})
	})
	$('#assetPackageName').blur(function(){
		$('.searchText').hide();
		$(this).css({
			'border':"1px solid #e2e2e2"
		})
	})
    $('.myForm').show();
    
    $('#assetPackageName').on('input',function(){
		$('.placeholder').fadeIn(2000)
	});

	$('#assetPackageName').on('blur',function(){
		$('.placeholder').fadeOut(2000)
	});
    
    $(window).on('click',function(){
		var h = $(".content-right").height() + 30;
		$(".content-left").height(h);
	});
	
    $(window).scroll(function(){
        var h = $(".content-right").height() + 30;
		$(".content-left").height(h);

		//头部导航隐藏
		if(getScrollTop()>60){
			$('.header').hide();
			$('.header').next().css({
				'top':'0'
			})
		}else {
			$('.header').show();
			$('.header').next().css({
				'top':'47px'
			})
		}
	});
		
    function getScrollTop() {
        var scrollPos;
        if (window.pageYOffset) {
            scrollPos = window.pageYOffset; 
        } else if (document.compatMode && document.compatMode != 'BackCompat'){ 
            scrollPos = document.documentElement.scrollTop; 
        } else if (document.body) { 
            scrollPos = document.body.scrollTop; 
        } 
        return scrollPos; 
	}
})
JS;
$this->registerJs($js);
